package com.test.jbpm;


import java.util.Set;

import com.test.jbpm.domain.Dept;




/**
 * 閲囩敤妯℃澘鏂规硶妯″紡
 * @author Administrator
 *
 */
public abstract class AbstractPermissionTreeMaker {

	private StringBuilder sbXml = new StringBuilder();
	
	private Dept firstLevelNode;
	
	protected Set<Dept> permissionIdSet;
	
	public AbstractPermissionTreeMaker(Dept firstLevelNode,
			Set<Dept> permissionIdSet) {
		this.firstLevelNode = firstLevelNode;
		this.permissionIdSet = permissionIdSet;		
	}

	/**
	 * 妯℃澘鏂规硶
	 * @return
	 */
	public String make() {
		sbXml.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
		sbXml.append("<tree id=\"0\">");	
		String xmlString = doMake(this.firstLevelNode);
		sbXml.append(xmlString);
		sbXml.append("</tree>");
		return sbXml.toString();
	}
	
	/**
	 * 濮旀淳缁欏瓙绫诲疄鐜扮殑鏂规硶
	 * @param firstLevelNode
	 * @return
	 */
	protected abstract String doMake(Dept firstLevelNode);
}
